/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * @file  Can_PBCfg.c
 * @brief Semidrive. AUTOSAR 4.3.1 MCAL Can Driver.
 * @date 2025-03-25 19:03:22
 */
#ifdef __cplusplus
extern "C" {
#endif

#include "Can.h"

/* Version and Check Begin */
/* Version Info Begin */
#define CAN_PBCFG_C_VENDOR_ID    0x8C
#define CAN_PBCFG_C_AR_RELEASE_MAJOR_VERSION    4
#define CAN_PBCFG_C_AR_RELEASE_MINOR_VERSION    3
#define CAN_PBCFG_C_AR_RELEASE_REVISION_VERSION 1
#define CAN_PBCFG_C_SW_MAJOR_VERSION    1
#define CAN_PBCFG_C_SW_MINOR_VERSION    0
#define CAN_PBCFG_C_SW_PATCH_VERSION    0
/* Version Info End */
/* Version and Check End */
/*PRQA S 1751  EOF*/

#define CAN_START_SEC_VAR_NO_INIT_UNSPECIFIED
#include "Can_MemMap.h"
uint32 vcan0_rx_buffer[0x50 * 4] __attribute__((aligned(CAN_CONFIG_ARCH_CACHE_LINE)));
uint32 vcan0_tx_buffer[0x50 * 4] __attribute__((aligned(CAN_CONFIG_ARCH_CACHE_LINE)));
#define CAN_STOP_SEC_VAR_NO_INIT_UNSPECIFIED
#include "Can_MemMap.h"

#define CAN_START_SEC_CONST_UNSPECIFIED
#include "Can_MemMap.h"
/* CAN controller ID 0 baud rate configurations. */
static const VAR(Can_BaudRateConfigType, CAN_VAR) Can0_BaudRateConfig[] = {
    {   /* Config0 */
        0U, /* baudRateConfigId */
        0U, /* extendBitTimingFormat */
        0U, /* enhancedBitTimingFormat */
        {
            8U, /* prescaler */
            7U, /* propSeg */
            8U, /* phaseSeg1 */
            4U, /* phaseSeg2 */
            2U, /* resyncJumpWidth */
        },
    },  /*Baud rate: 500kbps*/

};

/* CAN controller ID 1 baud rate configurations. */
static const VAR(Can_BaudRateConfigType, CAN_VAR) Can1_BaudRateConfig[] = {
    {   /* Config0 */
        0U, /* baudRateConfigId */
        0U, /* extendBitTimingFormat */
        0U, /* enhancedBitTimingFormat */
        {
            8U, /* prescaler */
            7U, /* propSeg */
            8U, /* phaseSeg1 */
            4U, /* phaseSeg2 */
            2U, /* resyncJumpWidth */
        },
    },  /*Baud rate: 500kbps*/

};


/* Controllers configuration. */
static const VAR(Can_ControllerConfigType, CAN_VAR) Can_ControllerConfig[] = {
    {   /* Controllre ID 0 */
        (boolean)TRUE,   /* Contoller is used=1 or not_used=0*/
        0xf8500000U,  /* baseAddr */
        MIXED,  /* rxProcType */
        MIXED,  /* txProcType */
        INTERRUPT,  /* busoffProcType */
        INTERRUPT,  /* wakeupProcType */
        0U,  /* controllerId */
        128U,  /* maxMBNum */
        (1U << 2) | (1U << 4) | (1U << 8), /* option */
        0U,   /* defaultBaudRateId */
        1U,  /* baudRateConfigCount */
        Can0_BaudRateConfig, /* baudRateConfig */
        RX_FIFO_MASK_FILTER_SCHEME,    /* rxFifoFilterTableFormat */
        MB_PRIORITY_HIGH, /* mbPriority */
        (Can_CoreIdType)0U, /* Core ID: 0:Core0 1:Core1 2:Core2 3:Core3 */
    },

    {   /* Controllre ID 1 */
        (boolean)TRUE,   /* Contoller is used=1 or not_used=0*/
        0xf8510000U,  /* baseAddr */
        MIXED,  /* rxProcType */
        MIXED,  /* txProcType */
        INTERRUPT,  /* busoffProcType */
        INTERRUPT,  /* wakeupProcType */
        1U,  /* controllerId */
        128U,  /* maxMBNum */
        (1U << 2) | (1U << 4), /* option */
        0U,   /* defaultBaudRateId */
        1U,  /* baudRateConfigCount */
        Can1_BaudRateConfig, /* baudRateConfig */
        RX_FIFO_FILTER_TYPE_A,    /* rxFifoFilterTableFormat */
        MB_PRIORITY_HIGH, /* mbPriority */
        (Can_CoreIdType)0U, /* Core ID: 0:Core0 1:Core1 2:Core2 3:Core3 */
    },

};









/* MB configuration. */
static const VAR(Can_MBConfigType, CAN_VAR) Can_MBConfig[] = {
    {   /* CAN_HTH_1 */
        CAN_ID_STANDARD, /* idType */
        TRANSMIT,    /* hohType */
        1U,  /* canObjId */
        0U,  /* controllerId */
        0U,   /* mbId */
        8U,  /* payloadSize */
        0U, /* fdPaddingVal */
        FALSE,    /* usePolling */
        0U,   /* filterCode */
        0U,   /* filterMask */
    },

    {   /* CanHardwareObject_0 */
        CAN_ID_STANDARD, /* idType */
        TRANSMIT,    /* hohType */
        2U,  /* canObjId */
        1U,  /* controllerId */
        0U,   /* mbId */
        8U,  /* payloadSize */
        0U, /* fdPaddingVal */
        FALSE,    /* usePolling */
        0U,   /* filterCode */
        0U,   /* filterMask */
    },

    {   /* CanHardwareObject_1 */
        CAN_ID_STANDARD, /* idType */
        TRANSMIT,    /* hohType */
        3U,  /* canObjId */
        16U,  /* vcancontrollerId */
        0U,   /* mbId */
        8U,   /* payloadSize */
        0U,   /* fdPaddingVal */
        FALSE,    /* usePolling */
        0U,   /* filterCode */
        0U,   /* filterMask */
    },

};
/* CAN_HRH_0 Rx Enhanced FIFO filter table. */
static const VAR(Can_RxFIFOFilterTableType, CAN_VAR) Can_CAN_HRH_0FilterTable[] = {
    {
        (uint32)0x00000000U,
        (uint32)0x00000000U
    },
    {
        (uint32)0x00000000U,
        (uint32)0x00000000U
    },

};

/* Rx FIFO configuration. */
static const VAR(Can_RxFifoConfigType, CAN_VAR) Can_RxFIFOConfig[] = {
    {   /* CAN_HRH_0 */
        CAN_ID_STANDARD, /* idType */
        0U,  /* canObjId */
        0U,  /* controllerId */
        FALSE,    /* usePolling */
        0U, /* usedMBNum */
        2U, /* fliterCodeNum */
        2U, /* standardFilterNum */
        0U, /* extendedFilterNum */
        0U, /* watermarkLevel */
        Can_CAN_HRH_0FilterTable, /* filterTable */
        TRUE,   /*usedDpe*/
    },

};

const VCan_FifoConfigType VCan0_FifoConfig ={
    vcan0_rx_buffer,
    vcan0_tx_buffer,
};

/* Controllers configuration. */
static const VAR(VCan_ControllerConfigType, CAN_VAR) VCan_ControllerConfig[] = {
    {   /* VControllre ID 0 */
        (boolean)TRUE,   /* Contoller is used=1 or not_used=0*/
        0xf8020000U,  /* dpeBase */
        16U,  /* controllerId */
        FALSE,   /*enableDrop*/
        &VCan0_FifoConfig,
        INTERRUPT,  /* rxProcType */
        INTERRUPT,  /* txProcType */
        (1U << 2),  /* intMask */
        (Can_CoreIdType)0U, /* Core ID: 0:Core0 1:Core1 2:Core2 3:Core3 */
    },

};

/* CAN configuration. */
CONST(Can_ConfigType, CAN_VAR) Can_Config = {
    Can_ControllerConfig,
    Can_MBConfig,
    Can_RxFIFOConfig,
    CAN_MB_COUNT,
    VCan_ControllerConfig,
};
#define CAN_STOP_SEC_CONST_UNSPECIFIED
#include "Can_MemMap.h"


#ifdef __cplusplus
}
#endif
